<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <title>手讯网管理系统 - 登录</title>
    <meta name="keywords" content="H+后台主题,后台bootstrap框架,会员中心主题,后台HTML,响应式后台">
    <meta name="description" content="H+是一个完全响应式，基于Bootstrap3最新版本开发的扁平化主题，她采用了主流的左右两栏式布局，使用了Html5+CSS3等现代技术">
    <link href="/static/css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="/static/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
    <link href="/static/css/animate.min.css" rel="stylesheet">
    <link href="/static/css/style.min.css" rel="stylesheet">
    <link href="/static/css/login.min.css" rel="stylesheet">
    <link href="/static/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <script>
        if(window.top!==window.self){window.top.location=window.location};
    </script>
</head>

<body class="signin">
    <div class="signinpanel">

        <div class="row">
            <div class="col-sm-7">
                <div class="signin-info">



                    <div class="m-b m-t text-center" style=" padding-top: 30px;">
                    <p> 手机用户请扫码登录 </p>
                    <img src="/static/img/erweima.png" style=" width: 152px;" />
                    </div>
                </div>
            </div>
            <div class="col-sm-5" style="text-align: center;">
            
                <form class="m-t login" role="form">
                    <h4 class="no-margins">登录</h4>
                    <p class="m-t-md">登录到手讯网管理系统</p>
                    <input type="text" class="form-control uname" name="username" placeholder="用户名" />
                    <input type="password" class="form-control pword m-b" name="password" placeholder="密码" />
                    <div id="yzm" {$login_error_count>=3?'':'style=" display: none"'}>
                    <div class="form-group">
                        <input type="text" class="form-control  input-s-sm pword" name="code" placeholder="验证码" />
                    </div>
                    <div class="form-group">
                       {:captcha_img('index/id/1')}
                    </div>
                        </div>
<!--                    <a href="#">忘记密码了？</a>-->
                    <button onclick="login()" type="button" class="btn btn-success btn-block">登录</button>

                </form>
            </div>
        </div>
          <div style="clear:both"></div>
        <div class="signup-footer">
            <div class="pull-right">
                江西手讯网 &copy; 2016 All Rights Reserved.
            </div>
        </div>
    </div>
    <script src="/static/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/static/js/plugins/sweetalert/sweetalert.min.js"></script>
<script src="/static/js/plugins/toastr/toastr.min.js"></script>
<script>
    function login() {
        $.ajax({
            url: "/Admin/index/login",
            type: "post",
            dataType: "json",
            data: $(".login").serialize(),
            success: function () {

                window.location.href = "/Admin/index/";
            },
            error: function (error) {



                swal({
                    title: '提示',
                    text: JSON.parse(error.responseText).message,
                    type: "warning",
                });

                if( JSON.parse(error.responseText).type=="checkCode"){
                    $("#yzm").show();

                }
                if( JSON.parse(error.responseText).type=="updateCode"){
                    $("#yzm img").click();
                }
            },
            beforeSend: function(){
                $("body").append('<div class="sk-spinner sk-spinner-cube-grid"><div class="sk-cube"></div><div class="sk-cube"></div><div class="sk-cube"></div><div class="sk-cube"></div><div class="sk-cube"></div><div class="sk-cube"></div><div class="sk-cube"></div><div class="sk-cube"></div><div class="sk-cube"></div></div>');
                $(".sk-spinner").css({position:"fixed",top:$(window).height()/2-20+'px',left:$(window).width()/2-20+'px'});
            },
            complete: function(){
                $(".sk-spinner").remove();
            }
        });
    }

    $(function () {
        $("body").keydown(function () {
            if (event.keyCode == "13") {
                login();
            }
        });
    });
</script>
</body>
</html>
